import { getVoiceDataService } from '../../../util/robot/voiceHeCheng';

// 通过文字获取语音识别的内容
export async function getVoiceData(ctx: Context, next: Next): Promise<void> {
  const { text } = ctx.request.body;

  try {
    const result = await getVoiceDataService(text);
    ctx.api.success(result, 'sucess');
  } catch (error) {
    ctx.api.fail(-1, error);
  }
  
  return next();
}
